﻿<UserControl x:Class="estoque.TimeAccountUC"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:local="clr-namespace:estoque"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             FontFamily="Segoe UI"
             d:DesignHeight="190" d:DesignWidth="300">
    <UserControl.Resources>
        <local:TimeSpanConverter x:Key="TimeSpanConverter"/>
        <local:DateTimeConverter x:Key="DateTimeConverter"/>
        <!--Können wir nicht verwenden, weil sonst die Propertychanged-Events nciht ins Mainwindow kommen-->
        <!--<local:TimeAccount x:Key="TimeAccountDataSource" d:IsDataSource="True"/>-->

        <Style x:Key="SmallStyle" TargetType="{x:Type TextBlock}">
            <Setter Property="TextWrapping" Value="NoWrap"/>
            <Setter Property="TextTrimming" Value="None"/>
            <Setter Property="Height" Value="20" />
            <Setter Property="TextWrapping" Value="Wrap" />
            <Setter Property="FontSize" Value="14.667" />
            <Setter Property="Foreground" Value="#76000000"/>
            <Setter Property="Margin" Value="14,0,0,0"/>
        </Style>
        <Style x:Key="BigStyle" TargetType="{x:Type TextBlock}">
            <Setter Property="TextWrapping" Value="NoWrap"/>
            <Setter Property="TextTrimming" Value="None"/>
            <Setter Property="Height" Value="40" />
            <Setter Property="TextWrapping" Value="Wrap" />
            <Setter Property="FontSize" Value="24" />
        </Style>

        <Style x:Key="RightSmallStyle" BasedOn="{StaticResource SmallStyle}" TargetType="{x:Type TextBlock}">
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="Margin" Value="0,0,7,0"/>
        </Style>

        <Style x:Key="RightBigStyle" BasedOn="{StaticResource BigStyle}" TargetType="{x:Type TextBlock}">
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="Margin" Value="0,0,7,0"/>
        </Style>
    </UserControl.Resources>
    <Expander ExpandDirection="Up" x:Name="expander">
        <Expander.Header>
            <StackPanel Orientation="Horizontal">
                <TextBlock FontSize="16"><Run Language="de-de" Text="Arbeitsende"/></TextBlock>
                <TextBlock Margin="10,0,0,0" Text="{Binding End, Converter={StaticResource DateTimeConverter}, Mode=OneWay}" FontSize="16" FontWeight="Bold" />
            </StackPanel>
        </Expander.Header>
        <Grid x:Name="LayoutRoot" Height="160" Background="#C4FFFFFF">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.5*"/>
                <ColumnDefinition MinWidth="151"/>
                <ColumnDefinition MinWidth="84"/>
                <ColumnDefinition Width="0.5*"/>
            </Grid.ColumnDefinitions>
            <StackPanel Background="White" Grid.Column="1" Margin="8" Orientation="Vertical" VerticalAlignment="Top">
                <TextBlock Style="{DynamicResource BigStyle}" Margin="0,0,0,2"><Run Language="de-de" Text="Arbeitsbeginn"/></TextBlock>
                <TextBlock Style="{DynamicResource SmallStyle}"><Run Language="de-de" Text="anwesend"/></TextBlock>
                <TextBlock Style="{DynamicResource SmallStyle}"><Run Language="de-de" Text="max. noch anwesend"/></TextBlock>
                <TextBlock Style="{DynamicResource SmallStyle}"><Run Language="de-de" Text="Überstunden"/></TextBlock>
                <TextBlock Style="{DynamicResource BigStyle}"><Run Language="de-de" Text="Arbeitsende"/></TextBlock>
            </StackPanel>

            <StackPanel Background="White" Grid.Column="2" Margin="0,8,8,8" Orientation="Vertical" VerticalAlignment="Top">
                <TextBox Height="42" TextWrapping="Wrap" Text="{Binding Start, Converter={StaticResource DateTimeConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="24" HorizontalAlignment="Right" Background="{x:Null}" BorderThickness="3" Width="75">
                    <TextBox.BorderBrush>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFA911C" Offset="0"/>
                            <GradientStop Color="#FFD7672F" Offset="1"/>
                        </LinearGradientBrush>
                    </TextBox.BorderBrush>
                </TextBox>
                <TextBlock Text="{Binding CurrentPresence, Converter={StaticResource TimeSpanConverter}, Mode=OneWay}" Style="{DynamicResource RightSmallStyle}"/>
                <TextBlock Text="{Binding MaxPresence, Converter={StaticResource TimeSpanConverter}, Mode=OneWay}" Style="{DynamicResource RightSmallStyle}" />
                <TextBlock Text="{Binding Overtime, Converter={StaticResource TimeSpanConverter}, Mode=OneWay}" Style="{DynamicResource RightSmallStyle}"/>
                <TextBlock Text="{Binding End, Converter={StaticResource DateTimeConverter}, Mode=OneWay}" Style="{DynamicResource RightBigStyle}"/>
            </StackPanel>
        </Grid>
    </Expander>
</UserControl>